<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>sy课堂</title>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css" th:href="@{/h-ui/css/H-ui.min.css}"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css" th:href="@{/h-ui.admin/css/H-ui.admin.css}"/>
    <link rel="stylesheet" type="text/css" href="../../static/lib/Hui-iconfont/1.0.8/iconfont.css" th:href="@{/lib/Hui-iconfont/1.0.8/iconfont.css}"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin" th:href="@{/h-ui.admin/skin/default/skin.css}"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css" th:href="@{/h-ui.admin/css/style.css}"/>
    <link rel="stylesheet" href="../../static/Semantic-UI-master/dist/semantic.min.css" th:href="@{/Semantic-UI-master/dist/semantic.min.css}">
    <link rel="stylesheet" href="../../static/css/custom.css" th:href="@{/css/custom.css}">
</head>
<body class=" ">
<!--头部导航-->
<nav class="ui attached segment m-padded-tb-mini">
    <div class="ui container">
        <div class="ui menu secondary font-size-middle font-y-center">

                <span class="ui teal header item">
                <img src="../../static/imges/1.png" th:src="@{/imges/1.png}" class="image-size-mini"/>
                </span>
            <a class="item" th:href="@{/}"><i class="home icon"></i>首页</a>
            <a class="item active" th:href="@{/sy/syuser/syclass}"><i class="building icon"></i>sy课堂</a>
            <a class="item" href="aboutwe.html" th:href="@{/sy/syuser/aboutwe}"><i class="info icon"></i>关于我们</a>

            <!--                用条件判断动态实现页面变化-->
            <div class="item right" th:if="${session.User}">
                <div class="ui simple dropdown">
                    <img class="ui avatar image dropdown" src="../static/imges/user.jpg" th:src="${session.User.userImg}">
                    <span th:text="${session.User.userName}"></span>
                    <div class="menu">
                        <a href="User/userPC.html" th:href="@{/sy/syuser/gopc}" class="item"><i class="user circle icon"></i>个人主页</a>
                        <a href="User/userPC.html" th:href="@{/sy/syuser/gopc}" class="item"><i class="edit outline icon"></i>管理中心</a>
                        <a href="/sy/syuser/logout" class="item"><i class="sign out alternate icon"></i>退出登录</a>
                    </div>
                </div>
            </div>
            <!--                注册在这-->
            <div class="item right" th:unless="${session.User}">
                <a onClick="join('注册','/sy/syuser/goregistered','10001','600','350')" href="javascript:;" class="item">注册</a>
                <a href="User/userlogin.html" th:href="@{/sy/syuser/gologin}" class="item">登录</a>
            </div>


        </div>

    </div>
</nav>
<!--中间内容-->
<div class="ui container m-padded-tb-ys bkdimg font-x-center">
    <div th:if="${session.User}" >
        <input hidden id="userId" th:value="${session.User.userId}">
        <div class="font-color-white" th:if="${session.User.userPrivilege}==0">
            <h1>用简单的方式，让每个课堂更精彩</h1>
            <p>一体化教学管理，全方位课堂支持，轻松好用的互动工具，与您一起实践智慧教学</p>
            <br><br><br>
            <button class="ui green button font-size-middle" id="classbegin">开始授课</button>
            <br><br>
            <span>想要授课需要先申请教师身份哦</span>
        </div>
        <div class="m-padded-t-bignol" th:if="${session.User.userPrivilege}==1">
            <h1 class="font-color-white">用简单的方式，让每个课堂更精彩</h1>
            <!--页面内容开始-->
            <div class="m-padded-t-superbig">
            <!--                左侧内容-->
                <div class="ui grid">
                    <div class="four wide column slide">
                        <div class="ui link list segment m-padded-b-mini">
                            <div class="active item m-padded-tb-middle font-x-center"><h3>我发布的课程列表</h3></div>
                            <span th:if="${session.myclass}">
                                <a class="item" style="line-height: 30px;" th:each="course:${session.myclass}" th:href="@{/sy/syuser/getoneclass(courseId=${course.courseId})}">
                                    <p style="line-height: 30px;font-family: 微软雅黑" th:text="${course.courseName}">11111111</p>
                                </a>
                            </span>
                            <span th:unless="${session.myclass}">
                                <span style="line-height: 60px;font-size: 12px">你还没有发布过课程......</span>
                            </span>
                            <button class="ui button teal mini" onclick="picture_add('课程发布','/sy/course/courseadd?userId=')"
                                    href="javascript:;" style="width: 100%;"><i class="Hui-iconfont">&#xe600;</i>发布新课程</button>

                        </div>
                    </div>
                    <!--   右侧内容 -->
                    <div class="twelve wide column" id="pc_classp">
                        <div class="ui segment font-x-center" style="height: 630px" id="pc_page">
                            <div class="ui secondary pointing menu" th:if="${session.myclass}">
                                <a class="item active"><span th:text="${session.acoursename}"></span></a>
                            </div>
                            <div class="ui secondary pointing menu" id="father1">
                                <!--       这里的active是被选中的意思     -->
                                <a class="item active xuanzhong1" id="qiehuan1">视频课件 </a>
                                <a class="item xuanzhong2" id="qiehuan2">课程作业 </a>
                                <a class="item right" th:if="${session.onecourseId}" target="_blank" th:href="@{/sy/video/appendvideo(courseid=${session.onecourseId})}"><button class="ui button teal" style="font-size: 0.8em;">+添加视频课件</button> </a>
                                <a class="item" th:if="${session.onecourseId}" target="_blank" th:href="@{/sy/homework/appendhomework(courseid=${session.onecourseId},useroradmin=1)}"><button class="ui button teal" style="font-size: 0.8em;">+作业发布</button> </a>
                            </div>
                            <!--            内容一                -->
                            <div class="" id="geren1">
                                <table class="table table-border table-bordered table-bg table-sort">
                                    <thead>
                                    <tr class="text-c">
                                        <th width="80">ID</th>
                                        <th width="80">课程ID</th>
                                        <th width="170">视频名称</th>
                                        <th width="60">小节</th>
                                        <th width="170">视频链接</th>
                                        <tH width="80">操作</tH>
                                    </tr>
                                    </thead>
                                    <tbody th:if="${session.myvideoofclass}">
                                    <tr class="text-c" th:each="video:${session.myvideoofclass}">
                                        <td th:text="${video.videoId}">1</td>
                                        <td th:text="${video.courseId}">1</td>
                                        <td th:text="${video.videoName}"></td>
                                        <td class="text-l" th:text="${video.videoLength}"></td>
                                        <td class="text-l" th:text="${video.videoUrl}">1</td>
                                        <td class="f-14 product-brand-manage">
                                            <a style="text-decoration:none" th:onClick="video_edit('视频编辑','',[[${video.videoId}]])" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>
                                            <a style="text-decoration:none" class="ml-5" th:onClick="video_del(this,[[${video.videoId}]])" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tbody th:unless="${session.myvideoofclass}">
                                        <tr>
                                            <td colspan="6"><span style="font-size: 15px" class="font-tmd">你还没有给课程上传过视频课件.....</span></td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <!--            内容二                -->
                            <div class="" id="geren2" hidden>
                                <table class="table table-border table-bordered table-bg table-sort">
                                    <thead>
                                    <tr class="text-c">
                                        <th width="60">作业ID</th>
                                        <th width="60">课程ID</th>
                                        <th width="60">题号</th>
                                        <th width="120">题目</th>
                                        <th width="60">第几次作业</th>
                                        <th width="90">A</th>
                                        <th width="90">B</th>
                                        <th width="90">C</th>
                                        <th width="90">D</th>
                                        <th width="60">正确答案</th>
                                        <tH width="70">操作</tH>
                                    </tr>
                                    </thead>
                                    <tbody id="searchshow" th:if="${session.myhomeworkbyclass}">
                                    <tr class="text-c" th:each="homework:${session.myhomeworkbyclass}">
                                        <td th:text="${homework.hwId}">1</td>
                                        <td th:text="${homework.courseId}">1</td>
                                        <td class="text-l" th:text="${homework.hwNum}"></td>
                                        <td class="text-l" th:text="${homework.hwTitle}">1</td>
                                        <td class="text-l" th:text="${homework.hwGroup}">1</td>
                                        <td class="text-l" th:text="${homework.hwCona}">1</td>
                                        <td class="text-l" th:text="${homework.hwConb}">1</td>
                                        <td class="text-l" th:text="${homework.hwConc}">1</td>
                                        <td class="text-l" th:text="${homework.hwCond}">1</td>
                                        <td th:text="${homework.hwAnswer}">C</td>
                                        <td class="f-14 product-brand-manage">
                                            <a style="text-decoration:none" th:onClick="homework_edit('作业编辑','',[[${homework.hwId}]])" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>
                                            <a style="text-decoration:none" class="ml-5" th:onClick="homework_del(this,[[${homework.hwId}]])" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
                                        </td>
                                    </tr>
                                    </tbody>
                                    <tbody th:unless="${session.myhomeworkbyclass}">
                                    <tr class="text-c">
                                        <td colspan="11">
                                            <span style="font-size: 15px" class="font-tmd">你还没有发布课程作业......</span>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="font-color-white" style="height: 320px;padding-top: 5em" th:unless="${session.User}">
        <br>
        <a th:href="@{/sy/syuser/gologin}"><h1 style="color: white">请先登录...</h1></a>
    </div>
</div>


</body>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js" th:src="@{/h-ui/js/H-ui.min.js}"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js" th:src="@{/h-ui.admin/js/H-ui.admin.js}"></script>
<script src="../../static/js/jquery-3.5.1.min.js" th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script src="../../static/js/jquery-ui.min.js" th:src="@{/js/jquery-ui.min.js}"></script>
<script src="../../static/Semantic-UI-master/dist/semantic.min.js" th:src="@{/Semantic-UI-master/dist/semantic.min.js}"></script>
<script src="../../static/js/sy.min.js" th:src="@{/js/sy.min.js}"></script>
<script type="text/javascript" src="../../static/lib/layer/2.4/layer.js" th:src="@{/lib/layer/2.4/layer.js}"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js" th:src="@{/h-ui.admin/js/H-ui.admin.js}"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js" th:src="@{lib/laypage/1.2/laypage.js}"></script>
<script type="text/javascript">
    //注册小窗口
    function join(title,url,id,w,h){
        layer_show(title,url,w,h);
    }
    $("#classbegin").click(function () {
        layer.open({
            type: 2,
            content: '/sy/syuser/permissions',
            area: ['450px','350px'],
            end: function () {
                location.reload();
            }
        })
    })


    /*课程-添加*/
    function picture_add(title,url){
        const userId = $("#userId").val();
        var index = layer.open({
            type: 2,
            title: title,
            content: url+userId
        });
        layer.full(index);
    }

    //视频课件部分的js
    /*视频-删除*/
    function video_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '/sy/video/deletevideo',
                cache: false,
                data: {'videoId':id},
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    layer.msg('出错了',{icon:0,time:1000});
                },
            });
        });
    }

    /*视频-编辑*/
    function video_edit(title,url,id,w,h){
        $.ajax({
            Type: 'get',
            cache: false,
            url: '/sy/video/goEditorvideo',
            data: {'videoid':id},
            contenType: 'application/json;charset:utf-8',
            success: function(data){
                layer_show(title,data,w,h);
            },
            error:function(data) {
                layer.msg('出错了',{icon:0,time:1000});
            },
        })
    }
    //课程作业部分的js
    /*作业-删除*/
    function homework_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '/sy/homework/deletehomework',
                cache: false,
                data: {'homeworkId':id},
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    layer.msg('出错了',{icon:0,time:1000});
                },
            });
        });
    }


    /*作业-编辑*/
    function homework_edit(title,url,id,w,h){
        $.ajax({
            Type: 'get',
            cache: false,
            url: '/sy/homework/goEditorhomework',
            data: {'homeworkid':id},
            contenType: 'application/json;charset:utf-8',
            success: function(data){
                layer_show(title,data,w,h);
            },
            error:function(data) {
                layer.msg('出错了',{icon:0,time:1000});
            },
        })
    }
</script>
</html>